package com.vhall.component.entity.record.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author shimingming
 * @since 2023/6/6 11:10
 */
@Getter
@AllArgsConstructor
public enum PvRecordSourceEnum {

    APP(0, "APP"),
    H5(1, "H5"),
    WECHAT(2, "微信"),


    ;
    private Integer value;

    private String description;

    public static String getDescription(Integer value) {
        PvRecordSourceEnum parse = parse(value);
        if (parse != null) {
            return parse.getDescription();
        }
        return StringUtils.EMPTY;
    }

    public static PvRecordSourceEnum parse(Integer value) {
        for (PvRecordSourceEnum anEnum : PvRecordSourceEnum.values()) {
            if (anEnum.getValue().equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
}
